<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.ultraq.net.nz/web/thymeleaf/layout ">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>标签信息</title>
  <link rel="stylesheet"
        th:href="@{https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback}"
        href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" th:href="@{/plugins/fontawesome-free/css/all.min.css}"
        href="../../static/plugins/fontawesome-free/css/all.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" th:href="@{/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css}"
        href="../../static/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" th:href="@{/plugins/datatables-responsive/css/responsive.bootstrap4.min.css}"
        href="../../static/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
  <link rel="stylesheet" th:href="@{/plugins/datatables-buttons/css/buttons.bootstrap4.min.css}"
        href="../../static/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
  <link rel="stylesheet" th:href="@{/plugins/datatables-select/css/select.bootstrap4.min.css}"
        href="../../static/plugins/datatables-select/css/select.bootstrap4.min.css">
  <link rel="stylesheet" th:href="@{/plugins/icheck-bootstrap/icheck-bootstrap.min.css}"
        href="../../static/plugins/icheck-bootstrap/icheck-bootstrap.min.css">
  <link rel="stylesheet" th:href="@{/plugins/toastr/toastr.min.css}"
        href="../../static/plugins/toastr/toastr.min.css">
  <link rel="stylesheet" th:href="@{/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css}"
        href="../../static/plugins/sweetalert2-theme-bootstrap-4/bootstrap-4.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" th:href="@{/dist/css/adminlte.min.css}"
        href="../../static/dist/css/adminlte.min.css">


  <link rel="stylesheet"
        th:href="@{https://cdn.bootcdn.net/ajax/libs/bootstrap-switch/4.0.0-alpha.1/css/bootstrap-switch.min.css}">
</head>

<body class="wrapper">
<input type="hidden" th:value="${msg}" id="msg">
<section class="content">
  <div class="container-fluid mt-2">
    <div class="row">
      <div class="col-3">
        <div class="card">
          <div class="card-header">
            <h3 class="card-title">
              <i class="fas fa-filter"></i>
              选择巡检组
              <i class="fas fa-redo-alt" style="margin-left: 6.5em;"></i>
            </h3>

          </div>
          <!-- /.card-header -->
          <div class="card-body p-0 table-responsive" style="height: 650px;">
            <table class="table table-sm">
              <thead>
              <tr>
                <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                <th>巡检组名称</th>
                <th>添加</th>
              </tr>
              </thead>
              <tbody th:each="group:${groups}">
              <tr data-widget="expandable-table" aria-expanded="false">
                <td th:text="${group.id}">1</td>
                <td th:text="${group.name}" th:onclick="showRefresh([[${group.id}]])">泉州</td>
                <td>
                  <div>
                    <button class="btn btn-outline-success btn-sm"><i class="fa-plus fas"></i>
                    </button>
                  </div>
                </td>
              </tr>
              </tbody>
            </table>
          </div>
          <!-- /.card-body -->
          <div style="display: flex">
            <p style="margin: 1em">巡检组</p>
            <p style="margin: 1em">单位</p>
          </div>
        </div>

      </div>
      <div class="col-9">
        <form th:action="@{/label/label/deleteLabels}" id="listForm">
          <div class="card">
            <div class="card-bodyp-0 table-responsive" style="height: 590px;">
              <table id="table" th:fragment="showRefresh" class="table table-hover table-sm">
                <thead>
                <tr>
                  <th>
                    <div class="icheck-primary">
                      <input type="checkbox" id="checkall">
                      <label for="checkall"></label>
                    </div>
                  </th>
                  <th class="text-center">巡检组</th>
                  <th class="text-center">单位</th>
                  <th class="text-center">标签名</th>
                  <th class="text-center">唯一码</th>
                  <th class="text-center">启用</th>
                  <th class="text-center">紧急</th>
                  <th class="text-center">采购时间</th>
                  <th class="text-center">过期时间</th>
                  <th class="text-center">安装时间</th>
                  <th class="text-center">巡检项</th>
                  <th class="text-center">编辑</th>
                  <th class="text-center">导出</th>
                  <th class="text-center">删除</th>
                </tr>
                </thead>
                <tbody th:if="${labels ne 'null'}">
                <tr th:each="label:${labels}">
                  <td>
                    <div class="icheck-primary">
                      <input name="idList" th:value="${label.id}" type="checkbox" th:id="${label.name}+${label.id}">
                      <label th:for="${label.name}+${label.id}"></label>
                    </div>
                  </td>
                  <div th:each="group:${groups}">
                    <td th:text="${group.name}" th:if="${label.groupId==group.id}" class="text-center">测试组</td>
                  </div>
                  <div th:each="unit:${units}">
                    <td th:text="${unit.name}" th:if="${label.unitId==unit.id}" class="text-center">福建时刻</td>
                  </div>
                  <td th:text="${label.name}" class="text-center">测试1</td>
                  <td th:text="${label.code}" class="text-center">11111</td>
                  <td th:text="${label.enable eq 0 ? '×':'√'}" class="text-center">
                    <i class="fas fa-check" style="color:red"></i>
                  </td>
                  <td th:text="${label.critical eq 0 ? '×':'√'}" class="text-center">
                    <i class="fas fal fa-times" style="color:green"></i>
                  </td>
                  <td th:text="${#dates.format(label.bugTime, 'yyyy-MM-dd')}" class="text-center">2020/7/14</td>
                  <td class="text-center">无</td>
                  <td th:text="${#dates.format(label.createTime, 'yyyy-MM-dd')}" class="text-center">2021/1/27 8:00:00
                  </td>
                  <td class="text-center">
                    <button type="button" class="btn btn-outline-success btn-sm"><i
                            class="fas fa-file-signature"></i></button>
                  </td>
                  <td class="text-center">
                    <a type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal"
                       data-target="#edit1"
                       th:onclick="edit_customer([[${label.id}]],[[${label.groupId}]],[[${label.name}]],[[${label.address}]],[[${label.code}]],[[${label.remark}]],[[${label.unitId}]])">
                      <i class="fas fa-edit"></i>
                    </a>
                  </td>
                  <td class="text-center">
                    <button type="button" class="btn btn-outline-info btn-sm">
                      <i class="fas fa-share"></i></button>
                  </td>
                  <td class="text-center">
                    <a onclick="return confirm('确认删除吗')" th:href="@{/label/label/delete?(id=${label.id})}" type="button"
                       class="btn btn-outline-danger btn-sm">
                      <i class="fas fa-times"></i>
                    </a>
                  </td>
                </tr>
                </tbody>
              </table>
            </div>
            <!-- /.card-body -->


          </div>
        </form>
      </div>
      <!-- /.card -->
    </div>

  </div>
  </div>
</section>

<!--添加信息的弹出层-->
<div id="edit" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header bg-primary">
        <!--                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>-->
        <h5 class="modal-title">
          <i class="fas fa-edit"></i>
          <span id="lblAddTitle">添加标签</span>
        </h5>
      </div>
      <form class="form-horizontal form-bordered form-row-stripe" id="ffAdd" th:action="@{/label/label/add}"
            method="post" data-toggle="validator" enctype="multipart/form-data">
        <div class="modal-body">
          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label>巡检组</label>
                <div class="col-md-10">
                  <select class="custom-select" id="GroupId" name="GroupId">
                    <option th:selected="${group.id eq GroupId}" th:each="group:${groups}" th:text="${group.name}"
                            th:value="${group.id}">option 1
                    </option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label>单位名称</label>
                <div class="col-md-10">
                  <select class="custom-select" id="UnitId" name="UnitId">
                    <option th:selected="${unit.id eq unitId}" th:each="unit:${units}" th:text="${unit.name}"
                            th:value="${unit.id}">option 1
                    </option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">标签名</label>
                <div class="col-md-10">
                  <input id="Name" name="Name" class="form-control" placeholder="标签名..."></input>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">唯一码</label>
                <div class="col-md-10">
                  <input id="Code" name="Code" class="form-control" placeholder="唯一码..."></input>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">地址</label>
                <div class="col-md-10">
                  <input id="Address" name="Address" class="form-control" placeholder="地址..."></input>
                </div>
              </div>
              <!--            </div>-->
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">是否启用</label>
                  <div class="col-md-4">
                    <div class="switch" id="isOpen">
                      <input id="Enable" value="1" name="Enable" type="checkbox" checked/>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">紧急</label>
                  <div class="col-md-4">
                    <div class="switch" id="isUrgent">
                      <input id="Critical" value="1" name="Critical" type="checkbox" checked/>
                    </div>
                  </div>
                </div>
              </div>
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">采购时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="BuyTime" name="BuyTime" class="form-control" placeholder="采购时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">过期时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="ExpiryTime" name="ExpiryTime" class="form-control" placeholder="过期时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">安装时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="CreateTime" name="CreateTime" class="form-control" placeholder="安装时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">备注信息</label>
                  <div class="col-md-10">
                    <textarea id="Remark" name="Remark" class="form-control" placeholder="备注信息..."></textarea>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="submit" class="btn btn-outline-primary">确定</button>
            <button type="button" class="btn btn-outline-danger" data-dismiss="modal">取消</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<!--修改信息的弹出层-->
<div id="edit1" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header bg-primary">
        <!--                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>-->
        <h5 class="modal-title">
          <i class="fas fa-edit"></i>
          <span id="lblAddTitle1">添加标签</span>
        </h5>
      </div>
      <form class="form-horizontal form-bordered form-row-stripe" id="ffEdit" th:action="@{/label/label/update}"
            method="post" data-toggle="validator" enctype="multipart/form-data">
        <div class="modal-body">
          <div class="row">
            <div class="col-md-12">
              <div class="form-group">
                <label>巡检组</label>
                <div class="col-md-10">
                  <select class="custom-select" id="GroupId1" name="GroupId">
                    <option th:selected="${group.id eq GroupId}" th:each="group:${groups}" th:text="${group.name}"
                            th:value="${group.id}">option 1
                    </option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label>单位名称</label>
                <div class="col-md-10">
                  <select class="custom-select" id="UnitId1" name="UnitId">
                    <option th:selected="${unit.id eq unitId}" th:each="unit:${units}" th:text="${unit.name}"
                            th:value="${unit.id}">option 1
                    </option>
                  </select>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">标签名</label>
                <div class="col-md-10">
                  <input id="Name1" name="Name" class="form-control" placeholder="标签名..."></input>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">唯一码</label>
                <div class="col-md-10">
                  <input id="Code1" name="Code" class="form-control" placeholder="唯一码..."></input>
                </div>
              </div>
            </div>
            <div class="col-md-12">
              <div class="form-group">
                <label class="control-label col-md-4">地址</label>
                <div class="col-md-10">
                  <input id="Address1" name="Address" class="form-control" placeholder="地址..."></input>
                </div>
              </div>
              <!--            </div>-->
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">是否启用</label>
                  <div class="col-md-4">
                    <div class="switch" id="isOpen1">
                      <input id="Enable1" value="1" name="Enable" type="checkbox" checked/>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">紧急</label>
                  <div class="col-md-4">
                    <div class="switch" id="isUrgent1">
                      <input id="Critical1" value="1" name="Critical" type="checkbox" checked/>
                    </div>
                  </div>
                </div>
              </div>
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">采购时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="BuyTime" name="BuyTime" class="form-control" placeholder="采购时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">过期时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="ExpiryTime" name="ExpiryTime" class="form-control" placeholder="过期时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <!--            <div class="col-md-12">-->
              <!--              <div class="form-group">-->
              <!--                <label class="control-label col-md-4">安装时间</label>-->
              <!--                <div class="col-md-10">-->
              <!--                  <input id="CreateTime" name="CreateTime" class="form-control" placeholder="安装时间..."></input>-->
              <!--                </div>-->
              <!--              </div>-->
              <!--            </div>-->
              <div class="col-md-12">
                <div class="form-group">
                  <label class="control-label col-md-4">备注信息</label>
                  <div class="col-md-10">
                    <textarea id="Remark1" name="Remark" class="form-control" placeholder="备注信息..."></textarea>
                  </div>
                </div>
              </div>
              <div>
                <input id="Tid" name="id" type="text" class="form-control" style="display: none"/>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button type="submit" class="btn btn-outline-primary">确定</button>
            <button type="button" class="btn btn-outline-danger" data-dismiss="modal">取消</button>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>

<!--删除操作的确认弹窗-->
<div id="delete" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header bg-warning">
        <!--                <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>-->
        <h5 class="modal-title">
          <i class="fas fa-exclamation-circle"></i>
          <span id="lblDeleteTitle">操作提醒</span>
        </h5>
      </div>
      <form class="form-horizontal form-bordered form-row-stripe" id="ffDelete" action="" data-toggle="validator"
            enctype="multipart/form-data">
        <div class="modal-body">
          <div class="row">

            <div class="col-md-12">
              <div class="form-group text-center">
                <i class="fa fa-exclamation-circle fa-5x" style="color: #ff3200"></i><br><br>
                <h4><strong>您确认删除选定的内容吗</strong></h4>
              </div>
            </div>

          </div>
        </div>
        <div class="modal-footer">
          <button type="submit" class="btn">取消</button>
          <button type="button" class="btn btn-outline-danger" data-dismiss="modal">确认删除</button>
        </div>
      </form>
    </div>
  </div>
</div>


<!-- jQuery -->
<script th:src="@{/plugins/jquery/jquery.min.js}"
        src="../../static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script th:src="@{/plugins/bootstrap/js/bootstrap.bundle.min.js}"
        src="../../static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables  & Plugins -->
<script th:src="@{/plugins/datatables/jquery.dataTables.min.js}"
        src="../../static/plugins/datatables/jquery.dataTables.min.js"></script>
<script th:src="@{/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js}"
        src="../../static/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script th:src="@{/plugins/datatables-responsive/js/dataTables.responsive.min.js}"
        src="../../static/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script th:src="@{/plugins/datatables-responsive/js/responsive.bootstrap4.min.js}"
        src="../../static/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script th:src="@{/plugins/datatables-buttons/js/dataTables.buttons.min.js}"
        src="../../static/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script th:src="@{/plugins/datatables-buttons/js/buttons.bootstrap4.min.js}"
        src="../../static/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script th:src="@{/plugins/datatables-select/js/select.bootstrap4.min.js}"
        src="../../static/plugins/datatables-select/js/select.bootstrap4.min.js"></script>
<script th:src="@{/plugins/jszip/jszip.min.js}"
        src="../../static/plugins/jszip/jszip.min.js"></script>
<script th:src="@{/plugins/pdfmake/pdfmake.min.js}"
        src="../../static/plugins/pdfmake/pdfmake.min.js"></script>
<script th:src="@{/plugins/pdfmake/vfs_fonts.js}"
        src="../../static/plugins/pdfmake/vfs_fonts.js"></script>
<script th:src="@{/plugins/datatables-buttons/js/buttons.html5.min.js}"
        src="../../static/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script th:src="@{/plugins/datatables-buttons/js/buttons.print.min.js}"
        src="../../static/plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script th:src="@{/plugins/datatables-buttons/js/buttons.colVis.min.js}"
        src="../../static/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<script th:src="@{/plugins/datatables-select/js/dataTables.select.min.js}"
        src="../../static/plugins/datatables-select/js/dataTables.select.min.js"></script>
<script th:src="@{/plugins/toastr/toastr.min.js}"
        src="../../static/plugins/toastr/toastr.min.js"></script>
<script th:src="@{/plugins/sweetalert2/sweetalert2.min.js}"
        src="../../static/plugins/sweetalert2/sweetalert2.min.js"></script>
<script th:src="@{/plugins/jquery-validation/jquery.validate.min.js}"
        src="../../static/plugins/jquery-validation/jquery.validate.min.js"></script>
<script th:src="@{/plugins/jquery-validation/additional-methods.min.js}"
        src="../../static/plugins/jquery-validation/additional-methods.min.js"></script>
<script th:src="@{/plugins/jquery-validation/localization/messages_zh.min.js}"
        src="../../static/plugins/jquery-validation/localization/messages_zh.min.js"></script>
<!-- AdminLTE App -->
<script th:src="@{/dist/js/adminlte.min.js}"
        src="../../static/dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/dist/js/demo.js}"
        src="../../static/dist/js/demo.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/bootstrap-switch/4.0.0-alpha.1/js/bootstrap-switch.min.js"
        th:src="@{https://cdn.bootcdn.net/ajax/libs/bootstrap-switch/4.0.0-alpha.1/js/bootstrap-switch.min.js}"></script>

<script>
  $(function () {
    $('#table').DataTable({
      'responsive': true,
      'lengthChange': false,
      'autoWidth': true,
      'iDisplayLength': 10, //默认10行
      'sPaginationType': 'full_numbers', //分页样式
      "language": {
        "sSearch": "搜索标签:",
        "sProcessing": "正在加载中......",
        "sLengthMenu": "每页显示 _MENU_ 条记录",
        "sZeroRecords": "对不起，查询不到相关数据！",
        "sEmptyTable": "表中无数据存在！",
        "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",
        "oPaginate": {
          "sFirst": "首页",
          "sPrevious": "上一页",
          "sNext": "下一页",
          "sLast": "末页"
        }
      },
      'ordering': false,
      'buttons': [
        {
          extend: 'excel',
          text: '导出 Excel',
          className: 'btn btn-success btn-sm'
        }, {
          extend: 'print',
          text: '打印',
          className: 'btn btn-default btn-sm'
        }, {
          extend: '',
          text: '添加',
          className: 'btn btn-info btn-sm',
          action: function () {
            $('#edit').modal('show');
          }
        }, {
          extend: '',
          text: '删除选中行',
          className: 'btn btn-danger btn-sm',
          action: function () {
            // $('#delete').modal('show');
            deleteLabels();
          }
        },
        {
          extend: '',
          text: '临时下发任务',
          className: 'btn btn-success btn-sm'
        },
        {
          extend: '',
          text: '批量编辑',
          className: 'btn btn-warning btn-sm'
        }
      ]
    }).buttons().container().appendTo('#table_wrapper .col-md-6:eq(0)')

    var checkall = $("#checkall");
    var items = $("input[name='idList']");
    checkall.click(function () {
      if ($(this).prop("checked")) {
        items.each(function () {
          $(this).prop('checked', true);
        })
      } else {
        items.each(function () {
          $(this).prop('checked', false);
        })
      }
      items.click(function () {
        checkall.prop("checked", items.length == $("input[name='idList']:checked").length ? true : false);
      })
    })
    $('#isOpen input').bootstrapSwitch({
      onText: 'On',
      offText: 'Off'
    });
    $('#isUrgent input').bootstrapSwitch({
      onText: 'Yes',
      offText: 'No'
    });
    $('#isOpen1 input').bootstrapSwitch({
      onText: 'On',
      offText: 'Off'
    });
    $('#isUrgent1 input').bootstrapSwitch({
      onText: 'Yes',
      offText: 'No'
    });
    var msg = $("#msg").val();
    var Toast = Swal.mixin({
      toast: true,
      position: 'top-end',
      showConfirmButton: false,
      timer: 3000
    });
    if (msg) {
      if (!msg.endsWith("成功！")) {
        toastr.error(msg)
      } else {
        toastr.success(msg)
      }
    }
    $('#ffAdd').validate({
      rules: {
        Name: {
          required: true,
          minlength: 2,
          maxlength: 8
        },
        Code: {
          required: true,
          minlength: 5,
        },
        Address: {
          required: true,
          maxlength: 30,
        },
      },

      errorElement: 'span',
      errorPlacement: function (error, element) {
        error.addClass('invalid-feedback');
        element.closest('.form-group').append(error);
      },
      highlight: function (element, errorClass, validClass) {
        $(element).addClass('is-invalid');
      },
      unhighlight: function (element, errorClass, validClass) {
        $(element).removeClass('is-invalid');
      }
    });
    $('#ffEdit').validate({
      rules: {
        Name: {
          required: true,
          minlength: 2,
          maxlength: 8
        },
        Code: {
          required: true,
          minlength: 5,
        },
        Address: {
          required: true,
          maxlength: 30,
        },
      },

      errorElement: 'span',
      errorPlacement: function (error, element) {
        error.addClass('invalid-feedback');
        element.closest('.form-group').append(error);
      },
      highlight: function (element, errorClass, validClass) {
        $(element).addClass('is-invalid');
      },
      unhighlight: function (element, errorClass, validClass) {
        $(element).removeClass('is-invalid');
      }
    });


  })

  function deleteLabels() {
    if (!confirm('确认删除选中行吗？'))
      return false;
    $("#listForm").submit();
  }

  function edit_customer(t_id, t_groupId, t_name,t_address, t_code, t_remark, t_unitid) {
    $("#Tid").val(t_id);
    $("#GroupId1").val(t_groupId);
    $("#Name1").val(t_name);
    $("#Address1").val(t_address);
    $("#Code1").val(t_code);
    $("#Remark1").val(t_remark);
    $("#UnitId1").val(t_unitid);
  }
  var data = {
    "ParentId":0
  }
  function showRefresh(ParentId){
    data["ParentId"] = ParentId;
    $("#table").load("/label/label/showRefresh",data);
  }
</script>
</body>
</html>
